package utils

import (
	"math/rand"
	"time"
)

// RandomString 根据给定的基本字符生成长度为n的随机字符串。
func RandomString(baseChars string, n int) string {
	r := rand.New(rand.NewSource(time.Now().UnixNano()))
	chars := []rune(baseChars)
	result := make([]rune, n)
	for i := range result {
		result[i] = chars[r.Intn(len(chars))]
	}
	return string(result)
}
